package com.tj.admin.rest.user;

import com.fqgj.common.utils.StringUtils;
import com.fqgj.exception.common.ApplicationException;
import com.tj.bo.common.conf.api.ApiResponse;
import com.tj.bo.user.client.UserWanningListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2020-08-21
 * Time: 16:07
 */
@RestController
@RequestMapping("/user/warningList")
public class WarningListController {

    @Autowired
    private UserWanningListService wanningListService;

    @RequestMapping("/add")
    public ApiResponse add(@RequestBody WarningListRequest request) {

        if (StringUtils.isEmpty(request.getUserCode())) {
            throw new ApplicationException("params invalid");
        }

        wanningListService.addUser(request.getUserCode(), request.getType());
        return new ApiResponse();
    }
}
